package com.clqteam.daoimpl;


import java.sql.Connection;
import java.sql.PreparedStatement;

import java.sql.SQLException;

import com.clqteam.dao.AddSupplierDao;
import com.clqteam.util.JDBCutil;

public class AddSupplierDaoImpl implements AddSupplierDao{
	/**
	 * 增加厂商信息
	 * @param supName供应商厂家名
	 * @param supContacts厂家联系人
	 * @param supPhone厂家联系人电话
	 * @param eId超市负责联系人
	 * @return   boolean
	 */
	@Override
	public boolean insertSupplier(String supName, String supContacts, String supPhone, int eId) {
		boolean bl=false;
		StringBuffer sql=new StringBuffer("");
		sql.append(" INSERT INTO s_supplier (s_supplier.supName,s_supplier.supContacts,s_supplier.supPhone,s_supplier.eId)");
		sql.append(" VALUES (?,?,?,?)");
		Connection con=JDBCutil.getConnection();
		try {
			PreparedStatement ps=con.prepareStatement(sql.toString());			
			ps.setString(1, supName);
			ps.setString(2, supContacts);
			ps.setString(3, supPhone);
			ps.setInt(4, eId);
			int i=ps.executeUpdate();
			if(i>0){
				bl=true;
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bl;
	}


	



}
